package myThread;

public class demo14 {

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
           while (true){
               System.out.println("helllo thread");
               try {
                   Thread.sleep(2000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
        t.start();
        Thread.sleep(1000);
        System.out.println(t.getState());
    }
}

//    public static void main(String[] args) throws InterruptedException {
//        Thread t = new Thread(() -> {
//            while (true) {
//
//            }
//        });
//        System.out.println(t.getState());//NEW
//        t.start();
//        Thread.sleep(1000);
//        System.out.println(t.getState());//RUNNABLE
//    }
//}


//    public static void main(String[] args) {
//        Thread t = new Thread(()->{
//            System.out.println("hello thread");
//        });
//        System.out.println(t.getState());
//        t.start();
//    }

